package com.cj.user.service.designpatterns.factory;

/**
 * @Author cheng jun
 * @Description: 懒汉式
 * @Date 2021/7/14 18:39
 */
public class SimpleFactory {

    private SimpleFactory() {
    }

    public static SimpleFactory getInstance() {
        return InnerSimpleFactory.instance;
    }

    private static class InnerSimpleFactory {
        private static final SimpleFactory instance = new SimpleFactory();
    }

    public Apple createApple() {
        return new Apple();
    }

    public Banana createBanana() {
        return new Banana();
    }
}
